<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
    
     <div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="formId">
					<div class="select-list">
						<ul>
							<li>
								题号：<input type="text" name="problemId"/>
							</li>
							<li>
								标题：<input type="text" name="title"/>
							</li>
							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
								<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
			
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table" data-mobile-responsive="true"></table>
			</div>
		</div>
	</div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var prefix = ctx + "acm/front";

        $(function() {
            var options = {
                url: prefix + "/list",
                modalName: "题目列表",
                striped:true,
				search: false,
				showSearch:false,
				showRefresh:false,
				showColumns:false,
				showToggle:false,
				showExport:false,
				pageSize: 25,
                columns: [
				{
					field : 'problemId', 
					title : '问题编号',
					formatter: function(value, row, index) {
						var actions = [];
                        actions.push('<a class="btn btn-success btn-xs" href="'+ prefix + '/detail?problemId='+ row.problemId + '" ><i class="fa fa-link"></i>'+value+'</a>  ');
                        return actions.join('');
					},
					visible: true
				},
				{
					field : 'title', 
					title : '标题'
					//,sortable: true
				},
				{
					field : 'accepted', 
					title : 'AC次数',
					formatter: function(value, row, index) {
						var actions = [];
                        actions.push('<a class="btn btn-success btn-xs" href="'+ prefix + '/status?problemId='+ row.problemId + '&verdict=5" ><i class="fa fa-link"></i>'+value+'</a>  ');
                        return actions.join('');
					}
				},

				{
					field : 'solved', 
					title : 'AC人数'
				},
				{
					field : 'submit', 
					title : '提交量'
						//align: 'center',
			            //cellStyle:{ css:{"word-break":"break-all"} }
				}]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>